<template>
	<view class="container">

		<view class="intro">本项目已包含uni ui组件，无需import和注册，可直接使用。在代码区键入字母u，即可通过代码助手列出所有可用组件。光标置于组件名称处按F1，即可查看组件文档。</view>
		<text class="intro">详见：</text>
		<uni-link :href="href" :text="href"></uni-link>
		{{count}}
		<button @click="add">增加</button>
		<button @click="decrement">减少</button>
		<button @click="getters">getters</button>
		{{doneTodosCount}}
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		data() {
			return {
				href: 'https://uniapp.dcloud.io/component/README?id=uniui',
				localCount:47
			}
		},
		computed:{
			 doneTodosCount () {
			    return this.$store.getters.doneTodos(2)
			  }
		}
		
		,
		methods: {
			add() {
				this.$store.commit('increment')
				console.log(this.$store.state.count)
			},
			decrement(){
				this.$store.commit('decrement')
			},
			getters(){
				console.log(this.$store.getters.doneTodos(2))
			}
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>